/**
 * Copyright (C) 2013 DaiKit.com - daikit-commons module (admin@daikit.com)
 *
 *         Project home : http://code.daikit.com/commons
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.daikit.commons.shared.exception.authentication;

import com.daikit.commons.shared.exception.DkException;
import com.daikit.commons.shared.exception.utils.DkExceptionMessageProvider;


/**
 * It should be thrown if the user tries to get logged and is already logged using another account.
 *
 * @author tcaselli
 * @version $Revision$ Last modifier: $Author$ Last commit: $Date$
 */
public class DkUserAlreadyAuthenticatedException extends DkException
{

	private static final long serialVersionUID = 2255868384666324985L;

	/**
	 * Default Constructor. This one should not be used but is here for serialization purpose.
	 */
	@Deprecated
	public DkUserAlreadyAuthenticatedException()
	{
		super();
	}

	/**
	 * Constructs a new DkUserAlreadyAuthenticatedException with given message. Create a Context that can be accessed by
	 * {@link #getContext()}.
	 *
	 * @param code
	 *           the exception code
	 * @param message
	 *           the message for the exception
	 */
	public DkUserAlreadyAuthenticatedException(final String code, final String message)
	{
		super(code, DkExceptionMessageProvider.format(code, message));
	}

	/**
	 * Constructs a new DkUserAlreadyAuthenticatedException with given message. Create a Context that can be accessed by
	 * {@link #getContext()}.
	 *
	 * @param code
	 *           the exception code
	 * @param message
	 *           the exception message
	 * @param cause
	 *           the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value
	 *           is permitted, and indicates that the cause is nonexistent or unknown.)
	 */
	public DkUserAlreadyAuthenticatedException(final String code, final String message, final Throwable cause)
	{
		super(code, DkExceptionMessageProvider.format(code, message), cause);
	}

	/**
	 * Constructs a new DkUserAlreadyAuthenticatedException with given message. Create a Context that can be accessed by
	 * {@link #getContext()}.
	 *
	 * @param code
	 *           the exception code
	 * @param message
	 *           the message for the exception
	 * @param optionalMessageArgs
	 *           optional message arguments
	 */
	public DkUserAlreadyAuthenticatedException(final String code, final String message, final Object... optionalMessageArgs)
	{
		super(code, DkExceptionMessageProvider.format(code, message, optionalMessageArgs));
	}

	/**
	 * Constructs a new DkUserAlreadyAuthenticatedException with given message. Create a Context that can be accessed by
	 * {@link #getContext()}.
	 *
	 * @param code
	 *           the exception code
	 * @param message
	 *           the exception message
	 * @param cause
	 *           the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value
	 *           is permitted, and indicates that the cause is nonexistent or unknown.)
	 * @param optionalMessageArgs
	 *           optional message arguments
	 */
	public DkUserAlreadyAuthenticatedException(final String code, final String message, final Throwable cause, final Object... optionalMessageArgs)
	{
		super(code, DkExceptionMessageProvider.format(code, message, optionalMessageArgs), cause);
	}
}
